<?php
    
        /* $soapClient =  new SoapClient('http://service.10h.vn:8080/services/ReceiverMT?wsdl',array(
                // Stuff for development.
                'trace' => 1,
                'exceptions' => true,
                'cache_wsdl' => WSDL_CACHE_NONE,
                'features' => SOAP_SINGLE_ELEMENT_ARRAYS,
                // Auth credentials for the SOAP request.
                'login' => 'wsvintelcom',
                'password' => 'wsvintelcom!@#',
                // Proxy url.
                'proxy_host' => 'service.10h.vn', // Do not add the schema here (http or https). It won't work.
                'proxy_port' => 8080,
                // Auth credentials for the proxy.
                'proxy_login' => NULL,
                'proxy_password' => NULL,
            )
        ); 
            
            $SoapMessage  = '<soap-env:envelope soap-env:encodingstyle="http://schemas.xmlsoap.org/soap/encoding/" xmlns:soap-enc="http://schemas.xmlsoap.org/soap/encoding/" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xmlns:xsd="http://www.w3.org/2001/XMLSchema" xmlns:ns1="http://ws.com" xmlns:soap-env="http://schemas.xmlsoap.org/soap/envelope/">
    <soap-env:body>
        <ns1:mtreceiver>
            <serviceId xsi:type="xsd:string">8555</serviceid>
            <userId xsi:type="xsd:string">841263175285</userid>
            <providerId xsi:type="xsd:string">MTPME1</providerid>
            <info xsi:type="xsd:string">gUI DC CHUA</info>
            <requestId xsi:type="xsd:string">493938084</requestid>
            <operator xsi:type="xsd:string">VMS</operator>
            <msgType xsi:type="xsd:string">1</msgtype>
            <contentType xsi:type="xsd:string">0</contenttype>
        </ns1:mtreceiver>
    </soap-env:body>
</soap-env:envelope>
            ';
            var_dump($soapClient);
            $result = $client->__doRequest(
                        $SoapMessage
                        , "http://service.10h.vn:8080/services/ReceiverMT?wsdl"
                        , "mtReceiver"
                        , "1"
                    );
               
               var_dump($result);   */  
               header('Content-Type: text/plain; charset=UTF-8');
       require_once('libs/nusoap.php');
              
              getCustomer();
              
     function setHeaders($client)
    {
        $headers = <<<EOT
<eWAYHeader xmlns="http://service.10h.vn:8080/services/ReceiverMT">
 <Username>wsvintelcom</Username>
      <Password>wsvintelcom!@#</Password>
    </eWAYHeader> 
EOT;
       $client->setHeaders($headers);
       return $client;
    }

     function getCustomer()
     {
        $url = 'http://service.10h.vn:8080/services/ReceiverMT?wsdl';  
        
        //function nusoap_client($endpoint,$wsdl = false,$proxyhost = false,$proxyport = false,$proxyusername = false, $proxypassword = false, $timeout = 0, $response_timeout = 30, $portName = ''){
        
        $client = new Nusoap_client($url, true, 'service.10h.vn',"8080");
        $client->setCredentials("wsvintelcom","wsvintelcom!@#");
        $client->decodeUTF8(true);
         $client->setHTTPEncoding("UTF-8");
      
       // $this->setHeaders($client);
       
     //  var_dump($client);
       
         $data2 = array();
         $data2["serviceId"] = "8555"; //Đầu số dịch vụ.
         $data2["userId"] = "841263175285"; //Số điện thoai người dùng.
         $data2["providerId"] ="MTPME1"; //Mã dịch vụ.
         $data2["info"] =base64_encode("Dang ky thanh cong akaizz5. Dang nhap va doi mat khau de an toan hon"); // Nội dung MT
         $data2["requestId"] ="493938084"; //MoID (requestId)
         $data2["operator"] ="VMS"; //telco
         $data2["msgType"] ="1"; //1 = Tính cước. 0 = Không tính cước.
         $data2["contentType"] ="0";  //  0 = Text. 
         
        var_dump($data2);

        $result = $client->call('mtReceiver', $data2);
        print_r("dfd".$result);
    }
?>
